<!--tvm票款差异协查-->
<template>
  <div class="shouPiaoYuanCYQRTZ approve el-card is-always-shadow el-card__body">
    <el-dialog
      title=""
      :visible.sync="dialogVisible"
      @close="closed"
      width="950px">
      <avue-form v-if="isReload" class="shouPiaoYuanCYQRTZForm" :option="option" v-model="formData" @submit="handleSubmit">

        <template slot-scope="scope" slot="incomeTime">
         <span>{{scope.value}}</span>
        </template>
        <template slot-scope="scope" slot="conductorPersonName">
          <span>{{scope.value}}</span>
        </template>
        <template slot-scope="scope" slot="diffAmount">
          <span>{{fenExYuangettoFixed(scope,'value')}}</span>
        </template>
        <!-- <template slot-scope="scope" slot="fujian">
          <div>申诉文件<el-button style="margin-left: 20px">下载</el-button></div>
        </template> -->

        <template slot-scope="scope" slot="menuForm">
          <el-button type="primary" @click="handleSubmit(2)">通过</el-button>
          <el-button type="primary" @click="handleSubmit(3)">不通过</el-button>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>


<script>
  import {
    fenExYuangettoFixed
  } from "../../../../../api/subwayRat/commonCheck";
  import {approveDataSwAuStDiffNotice} from "../../../../../api/subwayRat/conductorDifferences/conductorTicketChaYiShenhe/cheZhanPKCY/chezhanCYQRTZ";

  export default {
    components:{
    },
    data() {
      return {
        isReload:true,
        //1期限内，2期限外
        showType:1,
        dialogVisible:true,
        lineCodes:[],
        selectedKeys:[],
        stationCodes:[],
        conductorPersonNames:[],//售票员名称
        operationCodes:[],
        formData:{
          dynamic: []
        },
        option:{
        },
        parentThis:null
    }
    },
    created() {
    },
    methods: {
      fenExYuangettoFixed,
      handleSubmit(auditSate){
        let th=this;
        let param={};
        param.auditSate=auditSate;
        param.appealReason=this.formData.appealReason;
        param.overtimeReason=this.formData.overtimeReason;
        param.appealReply=this.formData.appealReply;
        param.ids=this.formData.id;
        param.appealState=this.formData.appealState;
        approveDataSwAuStDiffNotice(param).then(res=>{
            if(res.data.code==0){
              th.$message.success("操作成功！");
              th.closed();
              th.parentThis.getList();
            }else{
              th.$message.error("操作失败！");
            }
          }).catch((e)=>{
            th.$message.error("操作失败！");
          });
      },
      recallShow(row,showType,parentThis){
        this.parentThis=parentThis;
        this.showType=showType;
        this.getOption();
        this.formData=row;
      },
      closed(){
        this.dialogVisible=false;
        this.$parent.approveDialogVisible=false;
      },
      getOption(){
        let th=this;
        this.option=this.getAddOption(th);
        this.isReload=false;
        this.$nextTick(()=>{
          this.isReload=true;
        })
      },
      getAddOption(th) {
        return {
          submitBtn:false,
          emptyBtn:false,
          group:[
            {
              icon:'',
              label: '',
              // collapse:false,
              prop: 'group1',
              column: [{
                label: '收入日期',
                prop: 'incomeTime',
                labelWidth:130,
                formslot:true,
              },{
                label: '售票员',
                prop: 'conductorPersonName',
                labelWidth:130,
                formslot:true,
              },{
                label: '短款金额',
                prop: 'diffAmount',
                // width:'250',
                labelWidth:130,
                formslot:true,
              },
              // {
              //   label: '附件',
              //   prop: 'fujian',
              //   labelWidth:130,
              //   formslot:true,
              // },
              {
                label: '申诉原因',
                prop: 'appealReason',
                // width:'250',
                labelWidth:130,
                type:'textarea',
                display:this.showType==1,
              },{
                label: '超期申诉原因',
                prop: 'overtimeReason',
                // width:'250',
                labelWidth:130,
                type:'textarea',
                display:this.showType==2,
              },{
                label: '申诉回复',
                prop: 'appealReply',
                // width:'250',
                labelWidth:130,
                type:'textarea',
              }]
            },
          ]
        };
      }
    },
    mounted() {
    }
  }
</script>
<style lang="scss">
  .huLianWangShouPiaojiDataInput.EditorOrAdd{
    .avue-group[index='2']{
      .avue-form__group{
        .avue-form__row{
          width: 100%;
        }
      }
    }
    @media only screen and (min-width: 992px){
      width: 100%;
    }
    .avue-crud__tip{
      display: none;
    }
  }

</style>
